package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpTicketingDispathPageUtil extends SeleniumPageUtil {

	public final static By DIS_LINK_ASSIGN = By.xpath("//*[@id='ctl44_mnuMain_pnlMenu']/ul/li[@name='Assign']/a");
	public final static By DIS_LINK_REJECT = By.xpath("//*[@id='ctl44_mnuMain_pnlMenu']/ul/li[@name='Reject']/a");
	public final static By DIS_TABLE_MAIN_UNS = By.id("tbMainUns");
	public final static By DIS_TABLE_FE_CALL = By.id("tbMainFeCalled");
	public final static By DIS_TABLE_ASM_CALL = By.id("tbMainASMCalled");
	public final static By DIS_TABLE_DESC = By.xpath("//*[@id='divContentDescription']/table");
	public final static By DIS_INPUT_INCIDENT_NUMBER = By.id("ctl44_txtIncidentNumber");
	public final static By DIS_INPUT_CUSTOMER_NAME = By.id("ctl44_txtCustomerName");
	public final static By DIS_INPUT_CUS_TIC_NUM = By.id("ctl44_txtCustomerTicketNumber");
	public final static By DIS_INPUT_INCIDENT_DATE = By.id("ctl44_txtIncidentDate");
	public final static By DIS_INPUT_PRIORITY = By.id("ctl44_txtPriority");
	public final static By DIS_INPUT_SRO_TYPE = By.id("ctl44_txtSroType");
	public final static By DIS_INPUT_ASSET = By.id("ctl44_txtAssetName");
	public final static By DIS_INPUT_SERIAL_NUM = By.id("ctl44_txtSerialNumber");
	public final static By DIS_INPUT_ASSET_STATUS = By.id("ctl44_txtStatusAsset");
	
	public final static By DIS_SELECT_INCIDENT_POPUP_EVENT = By.id("ctl44_cboEvent");
	public final static By DIS_INPUT_INCIDENT_POPUP_NOTES = By.id("ctl44_txtNotesEventPopup");
	public final static By DIS_BUTTON_INCIDENT_POPUP_SAVE = By.id("btnSaveEventPopup");
	
	public final static By DIS_MENU_PANEL = By.id("ctl44_mnuMain_pnlMenu");
	public final static String DIS_ASSIGN_IFRAME = "site";
	public final static By DIS_INPUT_ASSIGN_POPUP_ASSIGNTO = By.id("ctl44_txtCreatedBy");
	public final static By DIS_SELECT_ASSIGN_POPUP_ASSIGNTO = By.id("ctl44_aceCreatedBy_completionListElem");
	public final static By DIS_INPUT_ASSIGN_POPUP_NOTES = By.id("ctl44_txtNotesAssingPopup");
	public final static By DIS_BUTTON_ASSIGN_POPUP_SAVE = By.id("btnSaveAssingPopup");
	
	public static void enterTicketingDispathPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterTicketDispathPage();
		waitForDispathPageToLoad();
	}
	
	public static void waitForDispathPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				DIS_TABLE_MAIN_UNS,DIS_TABLE_FE_CALL,DIS_TABLE_ASM_CALL,DIS_TABLE_DESC
		});
	SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(DIS_TABLE_MAIN_UNS));
	SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(DIS_TABLE_FE_CALL));
	SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(DIS_TABLE_ASM_CALL));
	SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(DIS_TABLE_DESC));
	}
}
